package com.jianhua.appmarket.module.controller;

import com.jianhua.appmarket.common.base.AppResponse;
import com.jianhua.appmarket.module.service.IAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app")
public class AppController {

    @Autowired
    private IAppService appService;

    @GetMapping(value = "/list")
    public AppResponse<?> listAllApp(){
        return AppResponse.success(appService.listAllApp());
    }

    @GetMapping(value = "/history/{appId}")
    public AppResponse<?> listAppVersions(@PathVariable("appId") Long appId){
        return AppResponse.success(appService.listAppVersions(appId));
    }
}
